package cn.guetzjb.core.utils;

import lombok.RequiredArgsConstructor;
import lombok.experimental.UtilityClass;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;

import java.text.SimpleDateFormat;
import java.util.Date;

@UtilityClass
public class UploadUtils {

    public String uploadToServer(MultipartFile file, boolean randomName) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        return new JschUtil().upload(file, "/opt/files/", dateFormat.format(new Date()), randomName);
    }
}
